package serializable.avro;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

import org.apache.avro.generic.GenericDatumWriter;
import org.apache.avro.io.DatumWriter;
import org.junit.Test;

import com.alibaba.fastjson.JSONObject;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;

public class AvroDemo {
	@Test
	public void toFile() {
		DatumWriter<A> dw = new GenericDatumWriter<A>();
		dw.setSchema(null);
	}
	@Test
	public void toObject() {
		Kryo kryo = new Kryo();
		try {
			kryo.register(A.class);
			Input input = new Input(new FileInputStream("a.kryo"));
			A a = kryo.readObject(input, A.class);
			System.out.println(JSONObject.toJSONString(a));
			input.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}

	}
}
